﻿using System.Collections.Generic;
using System.Data;
using CustomControls.Maps;
using Infrasturcture.Global.Controls.LobbyMap;
using MallInteractiveMap.ClientDataHandler;
using MallInteractiveMap.Common;
using MallInteractiveMap.DTO;
using System.Linq;

namespace MallInteractiveMap
{
    public class MapPresenter
    {
        public IMap GetMap(int floorIndex)
        {
            return Maps.GetMap(floorIndex);
        }
        public DTOMall GetMall()
        {
            string error = string.Empty;
            List<DTOMall> mall = ClientData.GetMall(new QueryParamList(), ref error);
            if (!string.IsNullOrEmpty(error))
            {

            }
            return mall.FirstOrDefault();
        }
        public List<DTOFloor> GetFloors()
        {
            string error = string.Empty;
            var floor = ClientData.GetFloor(new QueryParamList(), ref error);
            if (!string.IsNullOrEmpty(error))
            {

            }
            return floor;
        }

        public IMap GetMap(int? mapId)
        {
            string error = string.Empty;
            var param = new QueryParamList();
            param.Add(new QueryParamObj() { ParamName = "Id", DBType = DbType.Int32, ParamValue = mapId });
            var map = ClientData.GetMap(param, ref error).FirstOrDefault();
            if (!string.IsNullOrEmpty(error))
            {

            }
            return Maps.GetMap(map.Id);
        }
    }
}